<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>js事件机制</title>
</head>
<body>
    <div id="outer_div" onclick="console.log('handler: outer_div inline')" style="width:300px; height:300px; background-color:#999;">
        <div id="inner_div" onclick="console.log('handler: inner_div inline')" style="width:100px; height:100px; background-color:#333;"></div>
    </div>  
    <script>
        document.getElementById('outer_div').addEventListener('click', function(){
  console.log('bubble: outer_div');
}, false);
document.getElementById('outer_div').addEventListener('click', function(){
  console.log('capture: outer_div 02');
}, true);
document.getElementById('outer_div').addEventListener('click', function(){
  console.log('capture: outer_div 01');
}, true);
document.getElementById('outer_div').onclick = function(){
  console.log('handler: outer_div outline');
}

document.getElementById('inner_div').addEventListener('click', function(){
  console.log('bubble: inner_div');
}, false);
document.getElementById('inner_div').onclick = function(){
  console.log('handler: inner_div outline');
}
document.getElementById('inner_div').addEventListener('click', function(){
  console.log('capture: inner_div 02');
}, true);
document.getElementById('inner_div').addEventListener('click', function(){
  console.log('capture: inner_div 01');
}, true);
    </script>
</body>
</html>